---
title: Board Configuration
sidebar_position: 2.9
---

# Board Configuration

**To target a specific hardware board or peripheral,
you need to configure the pins, I2C, SPI, etc...** This is done by loading the
board configuration package for your specific hardware.

The inserted board configuration exposes a `pins` object that you can use to
configure drivers.

```ts
// highlight-next-line
import { pins } from "@dsboard/adafruit_qt_py_c3"
```

:::tip

In Visual Studio Code, on the file menu, click on the **wand** icon and select the board configuration.
If your board is already connected, DeviceScript will automatically detect it and
load the correct board configuration.

:::

Once the board configuration is imported, you can use the `pins` export to reference named pins from the board

```ts
import { pins } from "@dsboard/adafruit_qt_py_c3"
import { startLightBulb } from "@devicescript/servers"

const lightBulb = startLightBulb({
    // highlight-next-line
    pin: pins.A0_D0,
})
```

## Available Boards

You can find the list of supported devices and configuration in
the [devices](/devices) catalog.

If your board system-on-chip (SoC) is supported (ESP32, RP2040, ...) but the pin configuration
is not yet available, you have 2 options: create a new board configuration file
or configure the board by code.

## Configuration by Code

Some board configuration are generic and the I2C pins are not configured by default.
For example, the [pico-w](/devices/rp2040/pico-w) board configuration does not configure
the I2C pins and the code below configure them by code.

You can configure the board by code using the `configureHardware` function.

### I2C

```ts
import { pins } from "@dsboard/pico_w"
// highlight-next-line
import { configureHardware } from "@devicescript/servers"

// highlight-start
configureHardware({
    i2c: {
        pinSDA: pins.GP4,
        pinSCL: pins.GP5,
    },
})
// highlight-end
```

## Configuration by file

This is a more advanced scenario where you want to fork an existing board configuration
and publish configuration for a different board.

Refer to the [Add board](/devices/add-board) documentation to learn
how to create a new board configuration file.
